const baseUrl = 'http://47.108.208.170:6060'
// 图片上传接口
const Cookies = require('js-cookie')

const uploadImg = baseUrl + '/upload/image'
const uploadAudio = 'base/upload_audio'
// 文件上传接口
const uploadFile = 'base/upload_file'
const defaultRoleStatus = true // 默认权限
function formatTimestamp(timestamp, format = 'YYYY-MM-DD HH:mm:ss') {
  const date = new Date(timestamp)

  const year = date.getFullYear()
  const month = String(date.getMonth() + 1).padStart(2, '0')
  const day = String(date.getDate()).padStart(2, '0')
  const hours = String(date.getHours()).padStart(2, '0')
  const minutes = String(date.getMinutes()).padStart(2, '0')
  const seconds = String(date.getSeconds()).padStart(2, '0')

  switch (format) {
    case 'YYYY-MM-DD':
      return `${year}-${month}-${day}`
    case 'HH:mm:ss':
      return `${hours}:${minutes}:${seconds}`
    case 'YYYY-MM-DD HH:mm:ss':
    default:
      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
  }
}
module.exports = {
  title: '门禁后台管理系统',
  defaultTheme: '#408EFF', // 推荐默认主题
  // defaultTheme: '#6959CD',
  defaultRoleStatus, //
  formatTimestamp,
  /**
   * @type {boolean} true | false
   * @description Whether show the settings right-panel
   */
  showSettings: true,

  /**
   * @type {boolean} true | false
   * @description Whether need tagsView
   */
  tagsView: true,

  /**
   * @type {boolean} true | false
   * @description Whether fix the header
   */
  fixedHeader: false,

  /**
   * @type {boolean} true | false
   * @description Whether show the logo in sidebar
   */
  sidebarLogo: true,

  /**
   * @type {boolean} true | false
   * @description Whether support pinyin search in headerSearch
   * Bundle size minified 47.3kb,minified + gzipped 63kb
   */
  supportPinyinSearch: true,

  /**
   * @type {string | array} 'production' | ['production', 'development']
   * @description Need show err logs component.
   * The default is only used in the production env
   * If you want to also use it in dev, you can pass ['production', 'development']
   */
  errorLog: 'production',

  // 文件图片前缀
  baseUrl,
  // 图片上传接口
  uploadImg,
  // 文件上传接口
  uploadFile,
  // 接口前缀
  baseApi: baseUrl + '/admin',
  // 是否是手机客户端，如果是这里会限制富文本展示的预览宽度
  isPhone: false,
  // 文件上传全路径接口
  uploadFileAll: baseUrl + '/admin/' + uploadFile + '?key=' + Cookies.get('Admin-Token'),
  // 图片上传全路径接口
  uploadImgAll: baseUrl + '/' + uploadImg,
  uploadAudioAll: baseUrl + '/' + uploadAudio

}
